package grades;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class GradeManagerTest {
	
	GradeManager gm;
	
	@Before public void construct(){
		gm = new GradeManager();
	}
	
	@Test public void addTest(){
		try{
			gm.addGrade("a");
			gm.addGrade("a");
			gm.addGrade("a");
			gm.addGrade("a");
			gm.addGrade("b");
			gm.addGrade("b");
			gm.addGrade("b");
			gm.addGrade("c");
			gm.addGrade("c");
			gm.addGrade("d");
			gm.addGrade("f");
		} catch(InvalidGradeException e){
			Assert.assertTrue(false);
		}
		Assert.assertEquals(gm.getHistString(),"A:****\nB:***\nC:**\nD:*\nF:*\n");
		try{
			gm.addGrade("foo");
		} catch(InvalidGradeException e){
			Assert.assertFalse(e==null);
		}
	}
	
	@After public void finish(){
		System.out.println("Test finished!");
	}
}
